=== SYNOPSIS ===
{{{
#include <xp/sys/utl.h>

int xp_getmeminfo (xp_meminfo_t* mem);
}}}

=== DESCRIPTION ===
'''''xp_getmeminfo()''''' returns the memory information in the following structure:
{{{
typedef struct xp_meminfo_t xp_meminfo_t;

struct xp_meminfo_t
{
        xp_ulong_t totalram;  /* total memory size in bytes */
        xp_ulong_t usedram;   /* used memory size in bytes */
        xp_ulong_t freeram;   /* available memory size in bytes */
        xp_ulong_t totalswap; /* total swap space size in bytes */
        xp_ulong_t usedswap;  /* used swap space size in bytes */
        xp_ulong_t freeswap;  /* available swap space size in bytes */
};
}}}

=== RETURN VALUE ===
0 is returned on success while -1 is returned on error.

=== EXAMPLE ===
{{{
#include <xp/sys/utl.h>
#include <xp/bas/stdio.h>

int xp_main ()
{
	xp_meminfo_t info;

	if (xp_getmeminfo(&info) == -1) {
		xp_fprintf (xp_stderr, XP_TEXT("cannot get meminfo\n"));
		return -1;
	}

	xp_printf (XP_TEXT("Total ram: %lu bytes\n"), (unsigned long)info.totalram);
	xp_printf (XP_TEXT("Used ram: %lu bytes\n"), (unsigned long)info.usedram);
	xp_printf (XP_TEXT("Free ram: %lu bytes\n"), (unsigned long)info.freeram);

	xp_printf (XP_TEXT("Total swap: %lu bytes\n"), (unsigned long)info.totalswap);
	xp_printf (XP_TEXT("Used swap: %lu bytes\n"), (unsigned long)info.usedswap);
	xp_printf (XP_TEXT("Free swap: %lu bytes\n"), (unsigned long)info.freeswap);

	return 0;
}
}}}
